<template>
	<view class="addressBox" :style="{borderBottomWidth: borderBottom && '1px'}" @tap="toAddress">
		<view class="haveAddress" v-if="address">
			<view class="topBox">
				<view class="address">
					升龙广场 东站南街与东风南路交汇处
				</view>
				<u-icon name="arrow-right" size="36rpx" />
			</view>
			<view class="userinfo">
				<text class="tel">193****9999</text>
				<text class="name">王一一</text>
			</view>
		</view>
		<view class="noAddress" v-else-if="!disabled">
			请选择收货地址～
		</view>
	</view>
</template>

<script>
    export default {
		props: {
			borderBottom: Boolean,
			disabled: {
				type: Boolean,
				default: false
			}
		},
        data() {
            return {
				address: {}
			}
		},
		created() {
			this.address = uni.getStorageSync('userAddress')
		},
		methods: {
			toAddress() {
				// 跳转页面地址
				if (!this.disabled) {
					uni.navigateTo({
						url: '/pages/address/address?chooseAddress=true'
					})
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.addressBox {
	    padding: 15rpx 0;
	    font-family: PingFang SC, PingFang SC;
	    background-color: $uni-bg-color;
	    font-size: 30rpx;
	    color: $uni-text-color;
		border: 0 solid $uni-border-color-btm;
	    .haveAddress {
	        line-height: 56rpx;
	        font-size: 30rpx;
	        color: $uni-text-color;
	        .topBox {
	            display: flex;
	            align-items: center;
	            .address {
	                margin-right: 30rpx;
	                overflow: hidden;
	                text-overflow: ellipsis;
	                white-space: nowrap;
	            }
	        }
	        .userinfo {
	            display: flex;
	            align-items: center;
	            .tel {
	                color: $uni-text-color-grey-6;
	                margin-right: 30rpx;
	            }
	            .name {
	                color: $uni-text-color-black;
	            }
	        }
	    }
		.noAddress {
			padding: 15rpx 0;
			line-height: 56rpx;
			font-size: 30rpx;
			color: $uni-text-color;
		}
	}
</style>